<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>邮寄快递</title>

		<link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/common.css" />
		<link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/express.css" />
        <link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/mui.picker.css" />
        <link rel="stylesheet" href="<?php echo IMG_PATH ?>bdkd/css/mui.poppicker.css" />
		<style>
            .qjrxx{
                color:#333 !important;
            }
            #qjxxxx{
                color:#333 !important;
            }
            .sjrxx{
                color:#333 !important;
            }
            #sjxxxx{
                color:#333 !important;
            }
        </style>
	</head>
	<body>
    <input type="hidden" name="sname" id="sname1" value="" >
    <input type="hidden" name="sphone" id="sphone1" value="" >
    <input type="hidden" name="gname" id="gname1" value="" >
    <input type="hidden" name="gphone" id="gphone1" value="" >
    <!-- <p><a style=" display:inline-block;width: 4rem; height: 2rem; border: 1px solid #006600;" href="javascript:window.location.reload()">刷新</a></p> -->
		<div class="intact">
			<div>
			    <p>您的信息不完整</p>
			</div>
			<span>确定</span>
		</div>
		<div class="top">
			<div class="sender">
				<div><b></b></div>
				<div onclick="sendinfo()">

                    <input class="qjrxx" type="text" disabled="disabled" value="寄件人信息" style="color: #333;" />
					<textarea id="qjxxxx" name="text" class="textb" disabled="disabled" readonly="readonly" placeholder="请输入详细的寄件人信息,以便我们更好的为您服务" value="" style="border: none;color: #333;" ></textarea>
				</div>
			</div>
			<div class="recipients">
				<div><b></b></div>
				<div onclick="getinfo()">
                    <input class="sjrxx" type="text" disabled="disabled" value="收件人信息" style="color: #333;" />
					<textarea id="sjxxxx" class="shouhuorenxinxi texta" disabled="disabled" readonly="readonly" name="text" placeholder="请输入详细的收件人信息,以便我们更好的为您服务" value="" style="border: none;color: #333;" ></textarea>
				</div>
			</div>
		</div>

		<div class="content">
			<ul class="oul">
				<li class="genre">
					<div>
						<p>物品类型：</p>
						<span class="active">生活<b> · </b>日用</span>
						<span>文件<b> · </b>电子</span>
						<span>食品<b> · </b>其他</span>
					</div>
				</li>
				<li class="weight">
					<div class="aaa">
						<p style="font-size: 0.28rem;color: #333;">物品重量</p>
						<div class="DY">
						    <span class="dec">-</span>
						    <p class="kg">1</p>
						    <p class="kgs">公斤</p>
						    <span class="add">+</span>
						</div>
						<div class="weizhi">
							<img class="aimg" src="<?php echo IMG_PATH ?>bdkd/img/sss.png"/>
							<p>未知</p>
						</div>
					</div>
				</li>
				<li class="company">
					<div>
						<p>快递公司：</p>
						<span class="active">顺丰速运</span>
						<span>三通一达</span>
						<span>优速快递</span>
					</div>
				</li>
				<li class="freight">
					<div class="con">
						<div class="op">
							<p>运费估算</p>
						</div>
						<div class="cul">
							<ul>
								<li class="shouzhong">
									<p>首重：</p>
									<span>--</span>元
								</li>
								<li>,</li>
								<li class="xuzhong">
									<p>续重：</p>
									<span>--</span>元/公斤
								</li>
							</ul>
						</div>
						<div class="cp">
							<p><span>--</span>元</p>
							
						</div>
					</div>
				</li>
				<li class="timer">
					<div class="times">
						<div><p>寄件时间</p></div>
						<div>
							<input type="text" placeholder="9:00-10:00" readonly id="location" name="location">
							<img src="<?php echo IMG_PATH ?>bdkd/img/fanhui@2x.png"/>
						</div>
					</div>
				</li>
				
				
				<li class="tell">
					<div>
						<p>请输入想对邮递员说的...（可不填）</p>
						<textarea name="" rows="" cols="" placeholder="例：我需要包装袋" style="border:none; resize: none;" ></textarea>
				    </div>
				</li>
			</ul>	
		</div>
		
		
		<div class="pick">
			<div class="xieyi">
				<img src="<?php echo IMG_PATH ?>bdkd/img/ccc.png"/>
				<p>我已阅读并同意</p>
				<span>《便递服务协议》</span>
			</div>
			<div class="pick_up" onclick="send()">
				<p>开始寄件</p>
				<div>
					<img src="<?php echo IMG_PATH ?>bdkd/img/-@2x.png"/>
					<span>实际运费以上门确认为主，部分快递以体积计算</span>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="<?php echo IMG_PATH ?>bdkd/js/jquery-1.11.0.js" ></script>
    <script type="text/javascript" src="<?php echo IMG_PATH ?>bdkd/js/rem.js" ></script>

    <script type="text/javascript" src="<?php echo IMG_PATH ?>bdkd/js/mui.js" ></script>
    <script type="text/javascript" src="<?php echo IMG_PATH ?>bdkd/js/mui.picker.js" ></script>
    <script type="text/javascript" src="<?php echo IMG_PATH ?>bdkd/js/mui.poppicker.js" ></script>
    <script type="text/javascript">

        $("#location").on("click",function(){
            var picker = new mui.PopPicker();
            picker.setData([{
                value: "first",
                text: "9:00-10:00"
            }, {
                value: "second",
                text: "10:00-11:00"
            }, {
                value: "third",
                text: "11:00-12:00"
            }, {
                value: "fourth",
                text: "12:00-13:00"
            }, {
                value: "fifth",
                text: "13:00-14:00"
            }, {
                value: "six",
                text: "14:00-15:00"
            }, {
                value: "seven",
                text: "15:00-16:00"
            }, {
                value: "eight",
                text: "16:00-17:00"
            }, {
                value: "nine",
                text: "17:00-18:00"
            }, {
                value: "ten",
                text: "18:00-19:00"
            }
            ]);


//picker.pickers[0].setSelectedIndex(4, 2000);
//picker.pickers[0].setSelectedValue('fourth', 2000);
            picker.show(function(SelectedItem) {
                console.log(SelectedItem);
                $("#location").val(SelectedItem[0].text)
            })

        });







        var arr=[
			[{'id':'0','name':'燕郊'},{'shun':'1天','shou':'12','xu':'1'},{'san':'1天','shou':'8','xu':'2'},{'you':'1天','shou':'7','xu':'2'}],
			[{'id':'1','name':'北京'},{'shun':'1天','shou':'14','xu':'2'},{'san':'1天','shou':'9','xu':'3'},{'you':'1天','shou':'8','xu':'3'}],
			[{'id':'2','name':'上海'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'3','name':'天津'},{'shun':'1天','shou':'15','xu':'3'},{'san':'2天','shou':'10','xu':'3'},{'you':'2天','shou':'8','xu':'3'}],
			[{'id':'4','name':'重庆'},{'shun':'2天','shou':'18','xu':'6'},{'san':'3天','shou':'15','xu':'7'},{'you':'4天','shou':'11','xu':'5'}],
			[{'id':'5','name':'河北'},{'shun':'2天','shou':'14','xu':'2'},{'san':'2天','shou':'11','xu':'3'},{'you':'2天','shou':'8','xu':'3'}],
			[{'id':'6','name':'吉林'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'13','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'7','name':'黑龙'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'13','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'8','name':'内蒙'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'12','xu':'6'}],
			[{'id':'9','name':'安徽'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'10','name':'江苏'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'11','name':'浙江'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'12','name':'辽宁'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'2天','shou':'11','xu':'5'}],
			[{'id':'13','name':'山西'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'2天','shou':'11','xu':'5'}],
			[{'id':'14','name':'山东'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'15','name':'河南'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'16','name':'湖北'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'17','name':'湖南'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'12','xu':'6'},{'you':'3天','shou':'10','xu':'4'}],
			[{'id':'18','name':'江西'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'13','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'19','name':'广东'},{'shun':'2天','shou':'18','xu':'7'},{'san':'3天','shou':'12','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'20','name':'陕西'},{'shun':'2天','shou':'18','xu':'5'},{'san':'2天','shou':'13','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'21','name':'四川'},{'shun':'2天','shou':'18','xu':'6'},{'san':'3天','shou':'15','xu':'7'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'22','name':'福建'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'13','xu':'6'},{'you':'3天','shou':'11','xu':'5'}],
			[{'id':'23','name':'广西'},{'shun':'2天','shou':'18','xu':'7'},{'san':'3天','shou':'15','xu':'7'},{'you':'5天','shou':'12','xu':'6'}],
			[{'id':'24','name':'云南'},{'shun':'2天','shou':'18','xu':'7'},{'san':'3天','shou':'15','xu':'7'},{'you':'5天','shou':'12','xu':'6'}],
			[{'id':'25','name':'贵州'},{'shun':'2天','shou':'18','xu':'6'},{'san':'3天','shou':'15','xu':'7'},{'you':'3天','shou':'12','xu':'6'}],
			[{'id':'26','name':'海南'},{'shun':'2天','shou':'18','xu':'7'},{'san':'5天','shou':'15','xu':'7'},{'you':'5天','shou':'12','xu':'6'}],
			[{'id':'27','name':'甘肃'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'15','xu':'7'},{'you':'4天','shou':'12','xu':'6'}],
			[{'id':'28','name':'青海'},{'shun':'2天','shou':'18','xu':'5'},{'san':'4天','shou':'15','xu':'7'},{'you':'4天','shou':'12','xu':'6'}],
			[{'id':'29','name':'宁夏'},{'shun':'2天','shou':'18','xu':'5'},{'san':'3天','shou':'15','xu':'7'},{'you':'3天','shou':'12','xu':'6'}],
			[{'id':'30','name':'新疆'},{'shun':'3天','shou':'20','xu':'10'},{'san':'4天','shou':'20','xu':'10'},{'you':'6天','shou':'20','xu':'10'}],
			[{'id':'31','name':'西藏'},{'shun':'3天','shou':'26','xu':'21'},{'san':'5天','shou':'22','xu':'18'},{'you':'7天','shou':'20','xu':'15'}]
		
		];
	 
	 
	 function suanfa(num){
			var shouhuorenxinxi=$(".shouhuorenxinxi").val()
		    var xinxi=shouhuorenxinxi.substring(0,2);
		    for (var i=0;i<arr.length;i++) {
		    	if (xinxi==arr[i][0].name) {
		    		$(".shouzhong span").html(arr[i][num].shou)
//		    		console.log($(".shouzhong span").html(arr[i][num].shou))
		    		$(".xuzhong span").html(arr[i][num].xu)
		    		$(".cp p span").html(Number(arr[i][num].shou)+Number(arr[i][num].xu*($('.kg').html()-1)))
		    		$(".cp p").css("color","#14A5F9")
		    		return
		    	}else if(xinxi=="澳门"){
		    		console.log(xinxi)
		    		$(".intact").show()
    		        $(".intact p").html("目前无法发往澳门")
    		        $(".intact span").on("click",function(){
    			         $(this).parent().hide()
    		      })
		    	}else if(xinxi=="香港"){
		    		console.log(xinxi)
		    		$(".intact").show()
    		        $(".intact p").html("目前无法发往香港")
    		        $(".intact span").on("click",function(){
    			         $(this).parent().hide()
    		      })
		    	}else if(xinxi=="台湾"){
		    		console.log(xinxi)
		    		$(".intact").show()
    		        $(".intact p").html("目前无法发往台湾")
    		        $(".intact span").on("click",function(){
    			         $(this).parent().hide()
    		      })
		    	}
		    }
		
		}
		
		suanfa(1);
		
		
		
		$(".genre div span").on("click",function(){
    		$(this).addClass("active").siblings().removeClass("active")
    	});
	
    	$(".company div span").on("click",function(){
    		$(this).addClass("active").siblings().removeClass("active")
    		if ($(".company div .active").html()=="顺丰速运") {
    			
    			suanfa(1)  			
    		}else if ($(".company div .active").html()=="三通一达") {	
    			suanfa(2) 			
    		}else  {
    			suanfa(3)	
    		} 
    	});
    	
    	
    	
		$(".add").on("click",function(){
			$(".aimg").removeAttr("src").attr("src","<?php echo IMG_PATH ?>bdkd/img/sss.png")
			$(this).css("color","#14A5F9")
            $(".dec").css("color","#9f9f9f")
            var value=$(".kg").html()
            
			if(value == 30){
				$(".add").css("color","#9f9f9f")
				return
			}else if(value=="--"){
				$(".kg").html(1)
//				console.log($(".shouzhong span").html())
//				console.log($(".xuzhong span").html())
				$(".cp p span").html($(".shouzhong span").html());
				$(".cp p").css("color","#14A5F9")
//				var shou = Number($(".shouzhong span").html());
//					var xuzhong = Number($(".xuzhong span").html());
//					$(".cp p span").html(shou+xuzhong*$(".kg").html(1));
//					value++;
//				    $(".kg").html(value).css("color","#14A5F9");
			}else{
				var shou = Number($(".shouzhong span").html());
					var xuzhong = Number($(".xuzhong span").html());
					$(".cp p span").html(shou+xuzhong*$(".kg").html());
					
					value++;
				    $(".kg").html(value).css("color","#14A5F9");
//				    $(".aimg").removeAttr("src").attr("src","img/sss.png")
				    
			  
			    
			}
			
		});
    	
    	

//   当点击未知的时候
    $(".weizhi").on("click",function(){
    	 var src = $(this).find("img").attr("src");
    	if(src=="<?php echo IMG_PATH ?>bdkd/img/sss.png"){
    		$(".aimg").removeAttr("src").attr("src","<?php echo IMG_PATH ?>bdkd/img/ccc.png");
    	    $(".kg").html("--").css("color","#9F9F9F");
    	    $(".cp p span").html("--");
    	    $(".cp p").css("color","#9F9F9F")
    	}else{
    		$(".aimg").removeAttr("src").attr("src","<?php echo IMG_PATH ?>bdkd/img/sss.png");
    	    $(".kg").html(1).css("color","#9F9F9F");
//  	    $(".kg").html(1)
				console.log($(".shouzhong span").html());
				console.log($(".xuzhong span").html());
				$(".cp p span").html($(".shouzhong span").html());
				$(".cp p").css("color","#14A5F9")
    	    
    	}
    	
    })



//             当减少重量执行的效果
    			$(".dec").on("click",function(){
				$(this).css("color","#14A5F9")
				$(".add").css("color","#9f9f9f")
				var value=$(".kg").html()
//				console.log(value);
				if(value > 1){
					var shou = Number($(".shouzhong span").html());
					var xuzhong = Number($(".xuzhong span").html());
					$(".cp p span").html(shou+xuzhong*($(".kg").html()-2))
					value--;
					if(value == 1){
						$(".kg").html(value).css("color","#9f9f9f")
						$(".dec").css("color","#9f9f9f")
//						$(".aimg").removeAttr("src").attr("src","img/ccc.png")
				     
					}
					$(".kg").html(value)
					
					
				}else{
					$(".kg").html(value).css("color","#9f9f9f")
				}		
//				
			});
			
	


//   当点击寄件按钮时
    $(".pick_up").on("click",function(){
    	//console.log($(".textb").val());
    	//console.log($(".texta").val());
    	if($(".textb").val()=="" && $(".texta").val()==""){
    		$(".intact").show()
    		$(".intact p").html("寄件人跟收件人信息均未填写，请完善")
    		$(".intact span").on("click",function(){
    			$(this).parent().hide()
    		})
    	}else if($(".textb").val()==""){
    		$(".intact").show()
    		$(".intact p").html("您的寄件人信息未填")
    		$(".intact span").on("click",function(){
    			$(this).parent().hide()
    		})
    	}else if($(".texta").val()==""){
    		$(".intact").show()
    		$(".intact p").html("您的收件人信息未填")
    		$(".intact span").on("click",function(){
    			$(this).parent().hide()
    		})
    	}
    	
    })

        var Qjrxx=document.querySelector(".qjrxx");
        var Qjxxxx=document.querySelector("#qjxxxx");
        var Sjrxx=document.querySelector(".sjrxx");
        var Sjxxxx=document.querySelector("#sjxxxx");
        var g=localStorage;
        var fstr="";
        var fn=g.getItem('fname1');
        var fd=g.getItem('fdianhua1');
        $('#gname1').val(fn);
        $('#gphone1').val(fd);
        fstr+=fn+'  '+fd;
        if(fn&&fd) {
            Qjrxx.value = fstr;
            Qjrxx.style.color = '#333';
        }
        var f ="";
        var fx=g.getItem('fdizhi1');
        f+=fx;
        if(fx){
            Qjxxxx.value = f;
            Qjxxxx.style.color='#333';
        }

        var sstr="";
        var sn=g.getItem('sname1');
        var sd=g.getItem('sdianhua1');
        $('#sname1').val(sn);
        $('#sphone1').val(sd);
        sstr+=sn+'  '+sd;
        if(sn&&sd) {
            Sjrxx.value = sstr;
            Sjrxx.style.color = '#333';
        }
        var s ="";
        var sx=g.getItem('sdizhi1');
        var sxx=g.getItem('sxxxx1');
        s+=sx+sxx;
        if(sx&&sxx){
            Sjxxxx.value = s;
            Sjxxxx.style.color='#333';
        }



        function sendinfo() {

            window.location.href = '<?php echo SITE_PATH ?>work/bexpress/sendinfo';
        }
        function getinfo() {
            window.location.href = '<?php echo SITE_PATH ?>work/bexpress/getinfo';
        }


        function send(){
//            var i = $('.xyzt').val();
//            if(i==0){
//                alert('请阅读并同意《便递服务协议》');
//                return false;
//            }

            var sname=$(" input[ name='sname' ] ").val();

            var sphone=$(" input[ name='sphone' ] ").val();
            var gname=$(" input[ name='gname' ] ").val();
            var gphone=$(" input[ name='gphone' ] ").val();
            var saddress=$("#qjxxxx").val();
            var gaddress=$("#sjxxxx").val();
            var good_type=$(" input[ name='good_type' ] ").val();
            var weight= $(" input[ name='weight' ] ").val();
            var express_type= $(" input[ name='gsmz' ] ").val();
            //location
            var time=$(" input[ name='location' ] ").val();

            var content=$("#content").val();
            var money=$(" input[ name='money' ] ").val();
            var xyzt=$(" input[ name='xyzt' ] ").val();


            console.log(sname);
            console.log(sphone);
            console.log(gname);
            console.log(gphone);
            console.log(saddress);
            console.log(gaddress);


return false;

            $.ajax({
                url:"<?php echo SITE_PATH ?>work/bexpress/sendOrder",
                type:"post",
                data:{
                    'sname': sname,
                    'sphone': sphone,
                    'gname': gname,
                    'gphone': gphone,
                    'saddress': saddress,
                    'gaddress': gaddress,
                    'good_type' : good_type,
                    'weight' : weight,
                    'time' : time,
                    'express_type': express_type,
                    'content' : content,
                    'money' : money
                },
                success: function(data){
                    console.log(data);
                    if(data.result==1){
                        alert('提交成功!');
                    }else {
                        alert(data.msg);
                    }
                },
                error: function(){
                    alert('提交失败0!');
                }
//                async:"false";
            })
        }

		</script>
</html>





























